package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.system.domain.SnDrawConfig;
import com.ruoyi.system.mapper.SnDrawConfigMapper;
import com.ruoyi.system.service.ISnDrawConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 抽奖配置Service业务层处理
 *
 * @author ruoyi
 * @date 2022-12-27
 */
@Service
public class SnDrawConfigServiceImpl implements ISnDrawConfigService {
    @Autowired
    private SnDrawConfigMapper snDrawConfigMapper;

    /**
     * 查询抽奖配置
     *
     * @param id 抽奖配置主键
     * @return 抽奖配置
     */
    @Override
    public SnDrawConfig selectSnDrawConfigById(Long id) {
        return snDrawConfigMapper.selectSnDrawConfigById(id);
    }

    /**
     * 查询抽奖配置列表
     *
     * @param snDrawConfig 抽奖配置
     * @return 抽奖配置
     */
    @Override
    public List<SnDrawConfig> selectSnDrawConfigList(SnDrawConfig snDrawConfig) {
        return snDrawConfigMapper.selectSnDrawConfigList(snDrawConfig);
    }

    /**
     * 新增抽奖配置
     *
     * @param snDrawConfig 抽奖配置
     * @return 结果
     */
    @Override
    public int insertSnDrawConfig(SnDrawConfig snDrawConfig) {
        return snDrawConfigMapper.insertSnDrawConfig(snDrawConfig);
    }

    /**
     * 修改抽奖配置
     *
     * @param snDrawConfig 抽奖配置
     * @return 结果
     */
    @Override
    public int updateSnDrawConfig(SnDrawConfig snDrawConfig) {
        return snDrawConfigMapper.updateSnDrawConfig(snDrawConfig);
    }

    /**
     * 批量删除抽奖配置
     *
     * @param ids 需要删除的抽奖配置主键
     * @return 结果
     */
    @Override
    public int deleteSnDrawConfigByIds(String ids) {
        return snDrawConfigMapper.deleteSnDrawConfigByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除抽奖配置信息
     *
     * @param id 抽奖配置主键
     * @return 结果
     */
    @Override
    public int deleteSnDrawConfigById(Long id) {
        return snDrawConfigMapper.deleteSnDrawConfigById(id);
    }

    /**
     * 获取抽奖日期为当前日期的配置
     *
     * @return
     */
    @Override
    public List<SnDrawConfig> getCurrentConfig() {
        return snDrawConfigMapper.getCurrentConfig();
    }
}
